//必填
export const required = (str: string) => {
    return {
        required: true,
        message: str,
    };
};
//手机号
export const tel = {
    pattern: /^1[3456789]\d{9}$/,
    message: '请输入正确的手机号',
};
//密码格式
export const password1 = {
    pattern: /^[A-Za-z0-9]{6,12}$/,
    message: '请输入6-12位数字或者字母',
};

export const getLabel = (list: any[], value: any): string => {
    if (value) {
        const data = list.find((item) => {
            return item.value === value;
        });
        return data.label;
    } else {
        return '';
    }
};
//车辆类型
export const vehicleTypeArr = [
    {
        value: 1,
        label: '民用车',
    },
    {
        value: 2,
        label: '民营车',
    },
];
//行业类型
export const industryTypeArr = [
    {
        label: '快递',
        value: 1,
    },
    {
        label: '外卖',
        value: 2,
    },
    {
        label: '闪送',
        value: 3,
    },
    {
        label: '其他',
        value: 4,
    },
];
//异常情况类型
export const abnormalTypeArr = [
    {
        label: '占用机动车道',
        value: 1,
    },
    {
        label: '占用消防通道',
        value: 2,
    },
    {
        label: '闯红灯',
        value: 3,
    },
    {
        label: '超载',
        value: 4,
    },
    {
        label: '不戴头盔',
        value: 5,
    },
    {
        label: '乱停乱放',
        value: 6,
    },
    {
        label: '违规充电',
        value: 7,
    },
    {
        label: '其他',
        value: 8,
    },
];
